package person.lance.regexandgame.game.scenes;

import person.lance.regexandgame.game.common.Role;
import person.lance.regexandgame.game.plant.Plant;
import person.lance.regexandgame.game.zombie.Zombie;

import java.util.ArrayList;
import java.util.Date;

@SuppressWarnings("ALL")
public abstract class Scenes {
    Date date;//时间
    int sunNum;//每秒下落太阳个数 沙漠场景很少数量
    volatile  ArrayList<Plant> plants = new ArrayList<Plant>();//种植的植物
    ArrayList<Zombie> zombies = new ArrayList<Zombie>();//僵尸
    @SuppressWarnings("AlibabaAvoidManuallyCreateThread")
    Thread myThread = new Thread(new MyThread());

    public void attack(Role role1, Role role2){
        role2.buckleBlood(role1.getAtk());
    }

    public void run(){
        myThread.start();
    }

    public int getSunNum() {
        return sunNum;
    }

    public void setSunNum(int sunNum) {
        this.sunNum = sunNum;
    }

    public ArrayList<Plant> getPlants() {
        return plants;
    }

    public void setPlants(ArrayList<Plant> plants) {
        this.plants = plants;
    }

    class MyThread implements Runnable{
        @Override
        public void run() {
            for(Plant plant : plants){
                attack(plant, zombies.get(0));
            }
        }
    }
}
